package com.exam.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.exam.domain.DTO.ExamPaperDTO;
import com.exam.domain.DTO.ExamPaperResponseDTO;
import com.exam.domain.Exam;
import com.exam.domain.Question;
import com.exam.service.ExamPaperService;
import com.exam.service.ExamService;
import com.exam.utils.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@Api(tags = "组卷/发布考试")
@RestController
@RequestMapping(value = "/examPaper")
public class ExamPaperController {

    @Autowired
    private ExamPaperService examPaperService;

    @PostMapping("/addPaperManual")
    @ApiOperation(value = "手动组卷", notes = "手动组卷")
    @SaCheckPermission("teacher")
    public ResultBody addPaperManual(@RequestBody ExamPaperDTO examPaperDTO) {

        ExamPaperResponseDTO examPaperResponseDTO = examPaperDTO.handleInfo();
        return ResultBody.success(examPaperService.addPaperManual(examPaperDTO.getExam(),
                examPaperResponseDTO.getQuestionList(),
                examPaperResponseDTO.getIsCopyList(),
                examPaperResponseDTO.getScoreList(),
                examPaperResponseDTO.getBigTypeList()));
    }

    public ResultBody addPaperAuto() {
        return null;
    }

}
